package com.redoop.thread;

import com.redoop.common.LogHelper;
import com.redoop.db.ColumMgr;
import com.redoop.main.MainProc;

import java.util.Map;

public class MainThead extends Thread {
  private volatile boolean stopping = false;

  public void init() {
      if (!MainProc.gDBCtrl.InitDBFactory()) {
          LogHelper.error("DB初始化失败...");
          return;
      }
  }
      public void run () {
          ColumMgr columMgr = new ColumMgr();

          try {
              Map<String,Object> mapResult = columMgr.getColumJson();

              for (String key:mapResult.keySet()){

                  System.out.println(key+"~~~"+mapResult.get(key));
                  //TODO 可以写入文件中
              }
          } catch (Exception ex) {
              LogHelper.error("mZMQRep.recv error : " + ex.getMessage());
          }

          stopThead();
      }

      public void stopThead () {
          //this.stopping = true;
          try {

              MainProc.gDBCtrl.ExitDBFactory();
          } catch (Exception e) {
              LogHelper.error(e.getMessage());
          }
      }

}
